package com.cdtye.itps.cms.dao.detect;

import com.cdtye.common.mongocore.base.BaseEntity;
import com.cdtye.itps.models.base.model.attr.basic.AnchorAttr;
import com.cdtye.itps.models.base.model.attr.basic.DevClassAttr;
import com.cdtye.itps.models.base.model.attr.basic.DeviceAttr;
import com.cdtye.itps.models.base.model.attr.basic.DirectionAttr;
import com.cdtye.itps.models.base.model.attr.basic.LineAttr;
import com.cdtye.itps.models.base.model.attr.basic.PillarAttr;
import com.cdtye.itps.models.base.model.attr.basic.SiteAttr;
import com.cdtye.itps.models.base.model.attr.basic.TrackAttr;
import com.cdtye.itps.models.base.model.attr.basic.TunnelAttr;
import com.cdtye.itps.models.base.model.attr.defect.DefectGatherTypeAttr;
import com.cdtye.itps.models.base.model.attr.defect.DefectGradeAttr;
import com.cdtye.itps.models.base.model.attr.defect.DefectPhotoAttr;
import com.cdtye.itps.models.base.model.attr.defect.DefectReasonAttr;
import com.cdtye.itps.models.base.model.attr.defect.DefectTypeAttr;
import com.cdtye.itps.models.base.model.attr.defect.StatusTypeAttr;
import com.cdtye.itps.models.base.model.attr.defect.UserDefectTypeAttr;
import com.cdtye.itps.models.base.model.attr.detect.DetectDeviceAttr;
import com.cdtye.itps.models.base.model.attr.sysm.DeptAttr;
import com.cdtye.itps.models.base.model.attr.sysm.DicAttr;
import com.cdtye.itps.models.base.model.attr.sysm.SourceAttr;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.data.mongodb.core.mapping.Document;

import java.util.Date;
import java.util.List;

/**
 * @Author: tian lei
 * @Date: 2019/9/4 09:38
 * @Description:
 */
@ApiModel(value = "缺陷信息表")
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@Document(collection = "jcw_defect_info")
public class JcjcDefectInfo extends BaseEntity {
    @ApiModelProperty(value = "数据来源")
    private List<SourceAttr> sourceAttrList;

    @ApiModelProperty(value = "工区")
    private DeptAttr deptAttr;

    @ApiModelProperty(value = "线路")
    private LineAttr lineAttr;

    @ApiModelProperty(value = "所属站场区间")
    private SiteAttr siteAttr;

    @ApiModelProperty(value = "行别")
    private DirectionAttr directionAttr;

    @ApiModelProperty(value = "股道")
    private TrackAttr trackAttr;

    @ApiModelProperty(value = "所属隧道")
    private TunnelAttr tunnelAttr;

    @ApiModelProperty(value = "支柱")
    private PillarAttr pillarAttr;

    @ApiModelProperty(value = "锚段")
    private AnchorAttr anchorAttr;

    @ApiModelProperty(value = "设备")
    private DeviceAttr deviceAttr;

    @ApiModelProperty(value = "设备种类代码")
    private String devClassCode;

    @ApiModelProperty(value = "设备项目代码")
    private String proCode;

    @ApiModelProperty(value = "设备属性代码")
    private String attCode;

    @ApiModelProperty(value = "设备状态代码")
    private String statusCode;

    @ApiModelProperty(value = "设备状态类型")
    private Integer statusType;

    @ApiModelProperty(value = "设备状态")
    private StatusTypeAttr statusTypeAttr;

    @ApiModelProperty(value = "设备分类")
    private DevClassAttr devClassAttr;

    @ApiModelProperty(value = "标准缺陷分类")
    private DefectTypeAttr defectTypeAttr;

    @ApiModelProperty(value = "缺陷分类")
    private DicAttr defectClass;

    @ApiModelProperty(value = "用户缺陷分类")
    private UserDefectTypeAttr userDefectTypeAttr;

    @ApiModelProperty(value = "缺陷成因")
    private DefectReasonAttr reasonAttr;

    @ApiModelProperty(value = "缺陷等级")
    private DefectGradeAttr gradeAttr;

    @ApiModelProperty(value = "缺陷值")
    private String defectValue;

    @ApiModelProperty(value = "缺陷照片属性")
    private List<DefectPhotoAttr> picList;

    @ApiModelProperty(value = "缺陷描述")
    private String desc;

    @ApiModelProperty(value = "整改内容")
    private String rectifContent;

    @ApiModelProperty(value = "整改期限")
    private Date rectifDt;

    @ApiModelProperty(value = "公里标")
    private Double roadMark;

    @ApiModelProperty(value = "数据采集方式")
    private DefectGatherTypeAttr gatherTypeAttr;

    @ApiModelProperty(value = "数据来源ID（目前用于检测作业id）")
    private String sourceKeyId;

    @ApiModelProperty(value = "数据来源设备属性")
    private DetectDeviceAttr detectDeviceAttr;

    @ApiModelProperty(value = "发现日期")
    private Date findDt;

    @ApiModelProperty(value = "发现人")
    private String finder;

    @ApiModelProperty(value = "复核日期")
    private Date checkDt;

    @ApiModelProperty(value = "复核人")
    private String checker;

    @ApiModelProperty(value = "是否需要现场处理")
    private Integer needSceneHandle;

    @ApiModelProperty(value = "复测值")
    private String checkValue;

    @ApiModelProperty(value = "复核说明")
    private String checkDesc;

    @ApiModelProperty(value = "处理日期")
    private Date solveDt;

    @ApiModelProperty(value = "检修作业id")
    private String repairJobId;

    @ApiModelProperty(value = "处理人")
    private String solvePerson;

    @ApiModelProperty(value = "整改负责人")
    private String rectifPerson;

    @ApiModelProperty(value = "修后值")
    private String repairValue;

    @ApiModelProperty(value = "处理措施")
    private String solveMethod;

    @ApiModelProperty(value = "销号人")
    private String eliminatePerson;

    @ApiModelProperty(value = "销号时间")
    private Date eliminateDt;

    @ApiModelProperty(value = "恢复时间")
    private Date recoveryDt;

    @ApiModelProperty(value = "缺陷状态 0：未处理 1：已审核，2：下发，3：已整改，4：已销号")
    private Integer defectStatus;

    @ApiModelProperty(value = "备注")
    private String memo;

    @ApiModelProperty(value = "参数或零部件缺陷类别 1、参数异常缺陷；2、零部件缺陷；3、其他")
    private Integer parameterClass;

    @ApiModelProperty(value = "是否致命 1、致命缺陷；0、非致命缺陷")
    private Integer fatal;

    @ApiModelProperty(value = "是否以同步到oracle表，0、已同步，null、未同步")
    private Integer dataSysnFlag;

    public JcjcDefectInfoSection covEntity(){
        JcjcDefectInfoSection jcjcDefectInfoSection = new JcjcDefectInfoSection();
        jcjcDefectInfoSection.setDeptId(this.deptAttr.getDeptId());
        jcjcDefectInfoSection.setDiscoverPerson(this.finder);
        jcjcDefectInfoSection.setDefectGradeId("9999");
//        jcjcDefectInfoSection.setDelFlag(DelFlagEnum.NO);
        return jcjcDefectInfoSection;
    }

}
